class Robot(object):

    def __init__(self, width, height):
        """
        :type width: int
        :type height: int
        """
        self.width = width
        self.height = height
        self.zhouchang = 2 * (width + height) - 4
        self.now = 0
        self.start = True


    def step(self, num):
        """
        :type num: int
        :rtype: None
        """
        self.now = (self.now + num) % self.zhouchang
        self.start = False

    def getPos(self):
        """
        :rtype: List[int]
        """
        if 0 <= self.now < self. width:
            return [self.now, 0]
        if self.width <= self.now < self.width + self.height - 1:
            return [self.width - 1, self.now - self.width + 1]
        if self.width + self.height - 1 <= self.now < 2 * self.width + self.height - 2:
            return [2 * self.width + self.height - 3 - self.now, self.height - 1]
        return [0, self.zhouchang - self.now]

    def getDir(self):
        """
        :rtype: str
        """
        if self.now == 0:
            if self.start:
                return 'East'
            else:
                return 'South'
        if 0 < self.now < self.width:
            return 'East'
        if self.width <= self.now < self.width + self.height - 1:
            return 'North'
        if self.width + self.height - 1 <= self.now < 2 * self.width + self.height - 2:
            return 'West'
        return 'South'
